package com.pubinfo.passbook.api.controller.auth;

import com.pubinfo.passbook.common.entity.TRuleDiseasesType;
import com.pubinfo.passbook.common.model.dto.rule.RuleDiseasesTypeParam;
import com.pubinfo.passbook.common.model.vo.base.JsonResult;
import com.pubinfo.passbook.common.model.vo.base.MyPage;
import com.pubinfo.passbook.common.service.master.TRuleDiseasesTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("diseasesType/manager")
@Api(tags = "病种类型管理")
public class TDiseasesTypeController {
  
  @Resource
  private TRuleDiseasesTypeService diseasesTypeService;
  
  @PostMapping("save")
  @ApiModelProperty("新增病种类型")
  public JsonResult<String> saveDiseasesType(@RequestBody TRuleDiseasesType diseasesType) {
    return diseasesTypeService.saveDiseasesType(diseasesType);
  }
  
  @DeleteMapping("remove")
  @ApiModelProperty("删除病种类型")
  public JsonResult<String> removeDiseasesType(String diseasesTypeId) {
    return diseasesTypeService.deleteDiseasesType(diseasesTypeId);
  }
  
  @PostMapping("select")
  @ApiModelProperty("查询病种类型")
  public JsonResult<MyPage<TRuleDiseasesType>> selectDiseasesType(@RequestBody RuleDiseasesTypeParam param) {
    return JsonResult.success(new MyPage(diseasesTypeService.selectDiseasesType(param)));
  }
  
  @PostMapping("update")
  @ApiModelProperty("修改病种类型")
  public JsonResult<Boolean> updateDiseasesType(@RequestBody TRuleDiseasesType diseasesType) {
    return JsonResult.success(diseasesTypeService.updateById(diseasesType));
  }
}
